<!-- Main CSS-->
<link rel="stylesheet" type="text/css" href="/css/main.css">
<div id="hotelManagerDiv">
    <input type="hidden" id="userId" th:value="${session.user.userId}"/>
    <div class="row user">
        <div class="col-md-12">
            <div class="profile">
                <div class="info">
                    <h4 style="padding: 100px 0;">我的酒店</h4>
                </div>
                <div class="cover-image"></div>
            </div>
        </div>
        <div class="col-md-3">
            <a onclick="location.href='/hotel/hotels'" style="position: fixed;bottom: 10px;left: 30px;">
                <i class="fa fa-undo" style="font-size: 40px;"></i>
                返回主页
            </a>
            <div class="tile p-0">
                <ul class="nav flex-column nav-tabs user-tabs">
                    <li class="nav-item">
                        <a class="nav-link active" href="#user-timeline" data-toggle="tab">酒店基本信息</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#user-settings" data-toggle="tab">酒店简介</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#hotel-rooms" data-toggle="tab">酒店房间</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#hotel-policy" data-toggle="tab">酒店政策</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="#hotel-facility" data-toggle="tab">设施与服务</a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link" href="javascript:void(0)" onclick="deleteHotel()">删除</a>
                    </li>
                </ul>
            </div>
        </div>
        <div class="col-md-9">
            <div class="tab-content">
                <div class="tab-pane active" id="user-timeline">
                    <div th:replace="reception/hotel/pages/changeHotel/hotelMain"></div>
                </div>
                <div class="tab-pane fade" id="user-settings">
                    <div th:replace="reception/hotel/pages/changeHotel/hotelDetail"></div>
                </div>
                <div class="tab-pane fade" id="hotel-rooms">
                    <div th:replace="reception/hotel/pages/changeHotel/hotelRoom"></div>
                </div>
                <div class="tab-pane fade" id="hotel-policy">
                    <div th:replace="reception/hotel/pages/changeHotel/hotelPolicy"></div>
                </div>
                <div class="tab-pane fade" id="hotel-facility">
                    <div th:replace="reception/hotel/pages/changeHotel/hotelFacility"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- Essential javascripts for application to work-->
<script src="/js/jquery-3.3.1.min.js"></script>
<script src="/js/popper.min.js"></script>
<script src="/js/bootstrap.min.js"></script>
<script src="/js/main.js"></script>
<!-- The javascript plugin to display page loading on top-->
<script src="/js/plugins/pace.min.js"></script>
<script>
    function deleteHotel() {
        bootbox.confirm({
            message: "确定删除本酒店所有信息？？？",
            buttons: {
                confirm: {
                    label: "确定"
                },
                cancel: {
                    label: "取消"
                }
            },
            callback: function (result) {
                if (result) {
                    $.ajax({
                        url: "/api/hotelMain/" + $("#userId").val(),
                        type: "delete",
                        success: function (rs) {
                            if (rs.status === 200) {
                                layer.alert("删除成功", {icon: 1});
                                location.href = '/hotel/hotels';
                            }
                        },
                        error: function (rs) {
                            layer.alert(rs.responseText, {icon: 0});
                        }
                    })
                } else {
                    return;
                }

            }
        });
    }
</script>

